package StringExercise;
//替换
public class ReplaceAllDemo1 {
    public static void main(String[] args) {
        String line1="123ads123sdsa12sd";
        //将数字替换为#NUM#
        line1=line1.replaceAll("[0-9]+","#NUM#");
        System.out.println(line1);


        String line2="sdf4546dsf1asda1";
        line2=line2.replaceAll("[0-9]","#NUM#");
        System.out.println(line2);//替换每一个数字
    }
}
